<?php
$conf = array();
$query = "SELECT * FROM variable";
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)) {
$conf['name'] = $row['name'];
$conf['value'] = unserialize($row['value']);
}

function variable_set($name, $value) {
  echo "<p>name is: " . $name . "</p>";
  echo "<p>value is: " . $value . "</p>";
  $serialized_value = serialize($value);
  echo "<p>serialized_value is: " . $serialized_value . "</p>";
  $query = "UPDATE `variable` SET value = '$serialized_value' WHERE name = '$name'";
  echo "<p>update query is: " . $query . "</p>";
  mysql_query($query);
  echo "<p>mysql_affected_rows is: " . mysql_affected_rows() . "</p>";
  if (!mysql_affected_rows()) {
  	$query = "INSERT INTO `variable` (name, value) VALUES ('$name', '$serialized_value')";
    echo "<p>insert query is: " . $query . "</p>";
  	@mysql_query($query);
  }
  $conf[$name] = $value;
}

function _add_js($js){
  

}
function safe($value){ 
   return mysql_real_escape_string($value); 
}


/*
 * Load conf variables into conf
 */




?>